import { reactive, ref } from 'vue'
import { VxeGridProps } from 'vxe-table'

interface Rows {
  idNo: string
  secretsName: string
  secretsType: string
  date: string
  inventor: string
  unit: string
  submitDate: string
}

const selectOptions = reactive([
  {
    label: '博士',
    value: '0',
  },
  {
    label: '硕士',
    value: '1',
  },
  {
    label: '学士',
    value: '2',
  },
])

const gridOptions = reactive<VxeGridProps<any>>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  columns: [
    // { title: '序号', type: 'seq', width: 50 },
    { field: 'idNo', title: '标准编号' },
    { field: 'name', title: '标准名称' },
    { field: 'birthday', title: '标准类别' },
    { field: 'political', title: '归口专标委' },
    { field: 'phone', title: '备注' },
    { field: 'unitName', title: '发布日期' },
    { field: 'submitDate', title: '最近修订日期' },
    { field: 'submitDate', title: '状态' },
    {
      title: '操作',
      width: 200,
      slots: { default: 'operate' },
      fixed: 'right',
    },
  ],
  data: [
    {
      idNo: 'xxx',
      name: 'xxxx',
      sex: '1',
      birthday: '2023-01-01 00:00:00',
      phone: '177xx',
      unitName: 'xxxxx',
      submitDate: 'xxx',
    },
  ],
})

const valueoptions = reactive([
  {
    label: '标准名称',
    value: 'secretsName',
  },
  {
    label: '标准编号',
    value: 'unit',
  },
])

const operationLog = reactive<VxeGridProps>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  columns: [
    { field: 'type', title: '操作类型', width: 200 },
    { field: 'name', title: '操作员', width: 200 },
    { field: 'content', title: '操作内容' },
    { field: 'date', title: '操作时间', width: 200 },
  ],
  toolbarConfig: {
    slots: {
      buttons: 'toolbar_buttons',
    },
  },
  data: [
    {
      type: '修改状态',
      name: '曲丽丽',
      content: '修改了“软件名称”',
      date: '2023-01-01 00:00:00',
    },
    {
      type: '新增信息',
      name: '周毛毛',
      content: '新增软著信息',
      date: '2023-01-01 00:00:00',
    },
  ],
})

interface from {
  label: string
  prop: string
  type: string //select / date /tree
  options?: Array<{ label: string; value: string }>
}

const formList = ref([
  {
    label: '状态：',
    prop: 'a',
    type: 'select',
    options: [],
  },
  {
    label: '标准类别：',
    prop: 'b',
    type: 'select',
    options: [],
  },
  {
    label: '归口专标委：',
    prop: 'b',
    type: 'select',
    options: [],
  },
  {
    label: '发布日期：',
    prop: 'c',
    type: 'date',
  },
  {
    label: '最近修订日期：',
    prop: 'c',
    type: 'date',
  },
])

const tabFormList = ref([
  {
    label: '状态：',
    prop: 'a',
    type: 'select',
    options: [],
  },
  {
    label: '标准类别：',
    prop: 'b',
    type: 'select',
    options: [],
  },
  {
    label: '归口专标委：',
    prop: 'b',
    type: 'select',
    options: [],
  },
  {
    label: '起草单位',
    prop: 'c',
    type: 'select',
    options: [],
  },
  {
    label: '填报日期：',
    prop: 'c',
    type: 'date',
  },
  {
    label: '复审意见',
    prop: 'd',
    type: 'select',
    options: [],
  },
])

const tabGridOptions = reactive<VxeGridProps>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  columns: [
    // { title: '序号', type: 'seq', width: 50 },
    { field: 'idNo', title: '申请ID' },
    { field: 'name', title: '标准名称' },
    { field: 'birthday', title: '标准编号' },
    { field: 'political', title: '标准类别' },
    { field: 'phone', title: '归口专标委' },
    { field: 'unitName', title: '起草单位' },
    { field: 'unitName', title: '复审意见' },
    { field: 'submitDate', title: '填报日期' },
    { field: 'status', title: '状态', slots: { default: 'status_default' } },
    {
      title: '操作',
      width: 200,
      slots: { default: 'operate' },
      fixed: 'right',
    },
  ],
  data: [
    {
      idNo: 'xxx',
      name: 'xxxx',
      sex: '1',
      birthday: '2023-01-01 00:00:00',
      phone: '177xx',
      unitName: 'xxxxx',
      submitDate: 'xxx',
      status: '0',
    },
    {
      idNo: 'xxx',
      name: 'xxxx',
      sex: '1',
      birthday: '2023-01-01 00:00:00',
      phone: '177xx',
      unitName: 'xxxxx',
      submitDate: 'xxx',
      status: '1',
    },
    {
      idNo: 'xxx',
      name: 'xxxx',
      sex: '1',
      birthday: '2023-01-01 00:00:00',
      phone: '177xx',
      unitName: 'xxxxx',
      submitDate: 'xxx',
      status: '2',
    },
    {
      idNo: 'xxx',
      name: 'xxxx',
      sex: '1',
      birthday: '2023-01-01 00:00:00',
      phone: '177xx',
      unitName: 'xxxxx',
      submitDate: 'xxx',
      status: '3',
    }
  ],
})

const tabGridOptions4 = reactive<VxeGridProps>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  columns: [
    // { title: '序号', type: 'seq', width: 50 },
    { field: 'idNo', title: '申请ID' },
    { field: 'name', title: '标准名称' },
    { field: 'birthday', title: '标准编号' },
    { field: 'political', title: '标准类别' },
    { field: 'phone', title: '归口专标委' },
    { field: 'unitName', title: '起草单位' },
    { field: 'submitDate', title: '填报日期' },
    { field: 'submitDate', title: '状态' },
    {
      title: '操作',
      width: 200,
      slots: { default: 'operate' },
      fixed: 'right',
    },
  ],
  data: [
    {
      idNo: 'xxx',
      name: 'xxxx',
      sex: '1',
      birthday: '2023-01-01 00:00:00',
      phone: '177xx',
      unitName: 'xxxxx',
      submitDate: 'xxx',
    },
  ],
})

const descriptions = reactive([
  {
    label: '标准编号',
    value: '123',
  },
  {
    label: '标准名称',
    value: '2023-9-16',
  },
  {
    label: '备注',
    value: '2023-9-16',
  },
  {
    label: '状态',
    value: '在用',
  },
])

const descriptions2 = reactive([
  {
    label: '标准类别',
    value: '123',
  },
  {
    label: '归口专业',
    value: '123',
  },
  {
    label: '发布日期',
    value: '2023-9-16',
  },
  {
    label: '最近修改日期',
    value: '2023-9-16',
  },
])

export {
  gridOptions,
  operationLog,
  formList,
  valueoptions,
  descriptions,
  descriptions2,
  tabFormList,
  tabGridOptions,
  tabGridOptions4,
}
